<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>Elisa3: constants.h Source File</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>

</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">Elisa3
   
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.6.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>Globals</span></a></li>
    </ul>
  </div>
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
  initNavTree('constants_8h.html','');
</script>
<div id="doc-content">
<div class="header">
  <div class="headertitle">
<div class="title">constants.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="constants_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#include &lt;avr\io.h&gt;</span>
<a name="l00002"></a>00002 
<a name="l00003"></a>00003 <span class="comment">/***************/</span>
<a name="l00004"></a>00004 <span class="comment">/*** VARIOUS ***/</span>
<a name="l00005"></a>00005 <span class="comment">/***************/</span>
<a name="l00006"></a>00006 <span class="preprocessor">#ifndef RAD_2_DEG</span>
<a name="l00007"></a>00007 <span class="preprocessor"></span><span class="preprocessor">#define RAD_2_DEG 57.2957796                            // conversion factor from radiant to degrees; </span>
<a name="l00008"></a>00008 <span class="preprocessor"></span><span class="preprocessor">#endif                                                                          // use: degrees_value = radiant_value * RAD_2_DEG</span>
<a name="l00009"></a>00009 <span class="preprocessor"></span>
<a name="l00010"></a>00010 <span class="preprocessor">#ifndef CALIBRATION_CYCLES</span>
<a name="l00011"></a>00011 <span class="preprocessor"></span><span class="preprocessor">#define CALIBRATION_CYCLES 16                           // number of samples used for calibration</span>
<a name="l00012"></a>00012 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00013"></a>00013 <span class="preprocessor"></span>
<a name="l00014"></a>00014 <span class="preprocessor">#ifndef PAUSES                                                          // pauses based on adc base time counter &quot;delayCounter&quot;</span>
<a name="l00015"></a><a class="code" href="constants_8h.html#acf98101fd13b4e7488072f6639c75292">00015</a> <span class="preprocessor"></span><span class="preprocessor">#define PAUSE_1_MSEC 9                                          // they are not perfectly precise (based on 104 us)</span>
<a name="l00016"></a><a class="code" href="constants_8h.html#a6eef3276b4b74ac2be6c2069370e97c2">00016</a> <span class="preprocessor"></span><span class="preprocessor">#define PAUSE_10_MSEC 96</span>
<a name="l00017"></a><a class="code" href="constants_8h.html#a1e2f7427709f4b075deef46aae377dcd">00017</a> <span class="preprocessor"></span><span class="preprocessor">#define PAUSE_100_MSEC 961</span>
<a name="l00018"></a><a class="code" href="constants_8h.html#a7204e5369943f5177e6d34f16f83664f">00018</a> <span class="preprocessor"></span><span class="preprocessor">#define PAUSE_200_MSEC 1923</span>
<a name="l00019"></a><a class="code" href="constants_8h.html#a84938e01c329907a3d5fd50800e24800">00019</a> <span class="preprocessor"></span><span class="preprocessor">#define PAUSE_250_MSEC 2404</span>
<a name="l00020"></a><a class="code" href="constants_8h.html#acaf3a355573cf28b2a5fffc66e029f1c">00020</a> <span class="preprocessor"></span><span class="preprocessor">#define PAUSE_300_MSEC 2885</span>
<a name="l00021"></a><a class="code" href="constants_8h.html#aaec14398227a4af9e529bb0e52bad6c2">00021</a> <span class="preprocessor"></span><span class="preprocessor">#define PAUSE_400_MSEC 3846</span>
<a name="l00022"></a><a class="code" href="constants_8h.html#ac994119ec84d1b8dc60a383c14c0c77c">00022</a> <span class="preprocessor"></span><span class="preprocessor">#define PAUSE_500_MSEC 4807</span>
<a name="l00023"></a><a class="code" href="constants_8h.html#a5966c4bafe4620e28f7e0d9022ba3d15">00023</a> <span class="preprocessor"></span><span class="preprocessor">#define PAUSE_750_MSEC 7211</span>
<a name="l00024"></a><a class="code" href="constants_8h.html#a8dace3f83d27e5b95f55697077f0d8c3">00024</a> <span class="preprocessor"></span><span class="preprocessor">#define PAUSE_1_SEC 9615</span>
<a name="l00025"></a><a class="code" href="constants_8h.html#a6a194bdc32d3f6705457620936253116">00025</a> <span class="preprocessor"></span><span class="preprocessor">#define PAUSE_1500_MSEC 14423</span>
<a name="l00026"></a><a class="code" href="constants_8h.html#ad22b4ab180030cae5c45d1fbb8003426">00026</a> <span class="preprocessor"></span><span class="preprocessor">#define PAUSE_2_SEC 19230</span>
<a name="l00027"></a><a class="code" href="constants_8h.html#a51e3398f370d7c26649c208a3ee4fce7">00027</a> <span class="preprocessor"></span><span class="preprocessor">#define PAUSE_4_SEC 38462</span>
<a name="l00028"></a><a class="code" href="constants_8h.html#a7db74a054fd2fe7101db93e4d193e269">00028</a> <span class="preprocessor"></span><span class="preprocessor">#define PAUSE_5_SEC 48077</span>
<a name="l00029"></a><a class="code" href="constants_8h.html#a07a4c334765683397b0b9d107c0f7ee8">00029</a> <span class="preprocessor"></span><span class="preprocessor">#define PAUSE_6_SEC 57692</span>
<a name="l00030"></a><a class="code" href="constants_8h.html#ae50573e8b3a69312a381da12a11a760c">00030</a> <span class="preprocessor"></span><span class="preprocessor">#define PAUSE_10_SEC 96154</span>
<a name="l00031"></a><a class="code" href="constants_8h.html#a4f65649588bca707ec4bfd25fb635c28">00031</a> <span class="preprocessor"></span><span class="preprocessor">#define PAUSE_15_SEC 144230</span>
<a name="l00032"></a><a class="code" href="constants_8h.html#a1d795dd729d323f812cf85f62d99102b">00032</a> <span class="preprocessor"></span><span class="preprocessor">#define PAUSE_20_SEC 192307</span>
<a name="l00033"></a><a class="code" href="constants_8h.html#af49fca4d2a94dad5dca4204a84484b3f">00033</a> <span class="preprocessor"></span><span class="preprocessor">#define PAUSE_30_SEC 288461</span>
<a name="l00034"></a><a class="code" href="constants_8h.html#a00fe673c15938a8f5134d6165db6381e">00034</a> <span class="preprocessor"></span><span class="preprocessor">#define PAUSE_40_SEC 384615</span>
<a name="l00035"></a><a class="code" href="constants_8h.html#af77b5fb896a7e7d31e9cb53533fafa2f">00035</a> <span class="preprocessor"></span><span class="preprocessor">#define PAUSE_60_SEC 576923</span>
<a name="l00036"></a>00036 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00037"></a>00037 <span class="preprocessor"></span>
<a name="l00038"></a>00038 <span class="preprocessor">#ifndef UART_BUFF_SIZE</span>
<a name="l00039"></a>00039 <span class="preprocessor"></span><span class="preprocessor">#define UART_BUFF_SIZE 256</span>
<a name="l00040"></a>00040 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00041"></a>00041 <span class="preprocessor"></span>
<a name="l00042"></a><a class="code" href="constants_8h.html#a468f90bc3897b446b3d9c34a7331028d">00042</a> <span class="preprocessor">#define LINE_IN_THR 400</span>
<a name="l00043"></a><a class="code" href="constants_8h.html#a698dad2a16ca79e0abf2acc1c243715e">00043</a> <span class="preprocessor"></span><span class="preprocessor">#define LINE_OUT_THR 450</span>
<a name="l00044"></a>00044 <span class="preprocessor"></span>
<a name="l00045"></a><a class="code" href="constants_8h.html#a841e64d260beead1ee0e3d0d1df1b007">00045</a> <span class="preprocessor">#define SPEED_STEP_DELAY 400                                    // based on adc interrupt that is about 104 us</span>
<a name="l00046"></a>00046 <span class="preprocessor"></span>                                                                                        <span class="comment">// speed updated every SPEED_STEP_FREQ*104 us untill desired</span>
<a name="l00047"></a>00047                                                                                         <span class="comment">// speed reached</span>
<a name="l00048"></a>00048 
<a name="l00049"></a>00049 <span class="comment">/***********/</span>
<a name="l00050"></a>00050 <span class="comment">/*** NRF ***/</span>
<a name="l00051"></a>00051 <span class="comment">/***********/</span>
<a name="l00052"></a>00052 <span class="preprocessor">#ifndef PAYLOAD_SIZE</span>
<a name="l00053"></a>00053 <span class="preprocessor"></span><span class="preprocessor">#define PAYLOAD_SIZE 13                                         // payload of the packet received from the computer</span>
<a name="l00054"></a>00054 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00055"></a>00055 <span class="preprocessor"></span>
<a name="l00056"></a>00056 <span class="comment">/************************/</span>
<a name="l00057"></a>00057 <span class="comment">/*** SPEED CONTROLLER ***/</span>
<a name="l00058"></a>00058 <span class="comment">/************************/</span>
<a name="l00059"></a>00059 <span class="preprocessor">#ifndef PERIOD_MOTORS_100HZ</span>
<a name="l00060"></a>00060 <span class="preprocessor"></span><span class="preprocessor">#define PERIOD_MOTORS_100HZ     40000                   // old controller (elisa 2): we need a period time of 10 ms (100 Hz) =&gt; 0.01 * 4000000 = 40000</span>
<a name="l00061"></a>00061 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00062"></a>00062 <span class="preprocessor"></span>
<a name="l00063"></a>00063 <span class="preprocessor">#ifndef MAX_PWM</span>
<a name="l00064"></a>00064 <span class="preprocessor"></span><span class="preprocessor">#define MAX_PWM PERIOD_MOTORS_100HZ/100*60      // old controller (elisa 2): 60% of maximum</span>
<a name="l00065"></a>00065 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00066"></a>00066 <span class="preprocessor"></span>
<a name="l00067"></a>00067 <span class="preprocessor">#ifndef MAX_MOTORS_PWM</span>
<a name="l00068"></a>00068 <span class="preprocessor"></span><span class="preprocessor">#define MAX_MOTORS_PWM 1024                                     // max value for the pwm registers of the motors; 50% of maximum is then used actually</span>
<a name="l00069"></a>00069 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00070"></a>00070 <span class="preprocessor"></span>
<a name="l00071"></a>00071 <span class="comment">// horizontal speed controller</span>
<a name="l00072"></a>00072 <span class="preprocessor">#ifndef P_HORIZONTAL</span>
<a name="l00073"></a>00073 <span class="preprocessor"></span><span class="preprocessor">#define P_HORIZONTAL 15 //25                                            // P parameter of the PID speed controller</span>
<a name="l00074"></a>00074 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00075"></a>00075 <span class="preprocessor"></span>
<a name="l00076"></a>00076 <span class="preprocessor">#ifndef I_HORIZONTAL</span>
<a name="l00077"></a>00077 <span class="preprocessor"></span><span class="preprocessor">#define I_HORIZONTAL 2                                          // I parameter of the PID speed controller</span>
<a name="l00078"></a>00078 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00079"></a>00079 <span class="preprocessor"></span>
<a name="l00080"></a>00080 <span class="preprocessor">#ifndef D_HORIZONTAL</span>
<a name="l00081"></a>00081 <span class="preprocessor"></span><span class="preprocessor">#define D_HORIZONTAL 3                                          // D parameter of the PID speed controller</span>
<a name="l00082"></a>00082 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00083"></a>00083 <span class="preprocessor"></span>
<a name="l00084"></a>00084 <span class="preprocessor">#ifndef I_LIMIT_HORIZONTAL</span>
<a name="l00085"></a>00085 <span class="preprocessor"></span><span class="preprocessor">#define I_LIMIT_HORIZONTAL 1600                         // limit of the errors sum</span>
<a name="l00086"></a>00086 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00087"></a>00087 <span class="preprocessor"></span>
<a name="l00088"></a>00088 <span class="comment">// vertical speed controller</span>
<a name="l00089"></a>00089 <span class="preprocessor">#ifndef P_VERTICAL</span>
<a name="l00090"></a>00090 <span class="preprocessor"></span><span class="preprocessor">#define P_VERTICAL 25 //10</span>
<a name="l00091"></a>00091 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00092"></a>00092 <span class="preprocessor"></span>
<a name="l00093"></a>00093 <span class="preprocessor">#ifndef I_VERTICAL</span>
<a name="l00094"></a>00094 <span class="preprocessor"></span><span class="preprocessor">#define I_VERTICAL 3 //3</span>
<a name="l00095"></a>00095 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00096"></a>00096 <span class="preprocessor"></span>
<a name="l00097"></a>00097 <span class="preprocessor">#ifndef D_VERTICAL</span>
<a name="l00098"></a>00098 <span class="preprocessor"></span><span class="preprocessor">#define D_VERTICAL 2</span>
<a name="l00099"></a>00099 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00100"></a>00100 <span class="preprocessor"></span>
<a name="l00101"></a>00101 <span class="preprocessor">#ifndef I_LIMIT_VERTICAL</span>
<a name="l00102"></a>00102 <span class="preprocessor"></span><span class="preprocessor">#define I_LIMIT_VERTICAL 1600</span>
<a name="l00103"></a>00103 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00104"></a>00104 <span class="preprocessor"></span>
<a name="l00105"></a>00105 <span class="preprocessor">#ifndef INIT_KFF</span>
<a name="l00106"></a>00106 <span class="preprocessor"></span><span class="preprocessor">#define INIT_KFF 25                                                     // base feed forward for the vertical speed controller;</span>
<a name="l00107"></a>00107 <span class="preprocessor"></span><span class="preprocessor">#endif                                                                          // used then for computing the actual feed forward based on</span>
<a name="l00108"></a>00108 <span class="preprocessor"></span>                                                                                        <span class="comment">// the robot vertical angle</span>
<a name="l00109"></a>00109 <span class="comment">/****************/</span>
<a name="l00110"></a>00110 <span class="comment">/*** RGB LEDS ***/</span>
<a name="l00111"></a>00111 <span class="comment">/****************/</span>
<a name="l00112"></a>00112 <span class="preprocessor">#ifndef MAX_LEDS_PWM</span>
<a name="l00113"></a>00113 <span class="preprocessor"></span><span class="preprocessor">#define MAX_LEDS_PWM 255                                        // max value for the pwm registers of the leds</span>
<a name="l00114"></a>00114 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00115"></a>00115 <span class="preprocessor"></span>
<a name="l00116"></a>00116 <span class="comment">/*************************/</span>
<a name="l00117"></a>00117 <span class="comment">/*** IR REMOTE CONTROL ***/</span>
<a name="l00118"></a>00118 <span class="comment">/*************************/</span>
<a name="l00119"></a>00119 <span class="preprocessor">#ifndef STEP_MOTORS</span>
<a name="l00120"></a>00120 <span class="preprocessor"></span><span class="preprocessor">#define STEP_MOTORS 2                                           // step used to increase/decrease the motors speed when </span>
<a name="l00121"></a>00121 <span class="preprocessor"></span><span class="preprocessor">#endif                                                                          // receiving a command through TV remote.</span>
<a name="l00122"></a>00122 <span class="preprocessor"></span>                                                                                        <span class="comment">// speed (0..127) is expressed in 1/5 of mm/s (0..635 mm/s), thus </span>
<a name="l00123"></a>00123                                                                                         <span class="comment">// 2 means steps of 10 mm/s</span>
<a name="l00124"></a>00124 
<a name="l00125"></a>00125 <span class="comment">/*********************/</span>
<a name="l00126"></a>00126 <span class="comment">/*** ACCELEROMETER ***/</span>
<a name="l00127"></a>00127 <span class="comment">/*********************/</span>
<a name="l00128"></a>00128 <span class="preprocessor">#ifndef VERTICAL_THRESHOLD</span>
<a name="l00129"></a>00129 <span class="preprocessor"></span><span class="preprocessor">#define VERTICAL_THRESHOLD 20                           // threshold value to swtich from horizontal to vertical plane</span>
<a name="l00130"></a>00130 <span class="preprocessor"></span><span class="preprocessor">#endif                                                                          // (when Z &gt; threshold then vertical plane)</span>
<a name="l00131"></a>00131 <span class="preprocessor"></span>
<a name="l00132"></a>00132 <span class="preprocessor">#ifndef SAME_POS_NUM</span>
<a name="l00133"></a>00133 <span class="preprocessor"></span><span class="preprocessor">#define SAME_POS_NUM 200                                                // hysteresis value to pass from horizontal to vertical plane and</span>
<a name="l00134"></a>00134 <span class="preprocessor"></span><span class="preprocessor">#endif                                                                          // viceversa.</span>
<a name="l00135"></a>00135 <span class="preprocessor"></span>
<a name="l00136"></a>00136 <span class="preprocessor">#ifndef VERTICAL_POS</span>
<a name="l00137"></a>00137 <span class="preprocessor"></span><span class="preprocessor">#define VERTICAL_POS 0                                          // for easier code comprehension</span>
<a name="l00138"></a>00138 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00139"></a>00139 <span class="preprocessor"></span>
<a name="l00140"></a>00140 <span class="preprocessor">#ifndef HORIZONTAL_POS</span>
<a name="l00141"></a><a class="code" href="constants_8h.html#aa8421bdeb80011df284ec8d41c2b322a">00141</a> <span class="preprocessor"></span><span class="preprocessor">#define HORIZONTAL_POS 1                                        // for easier code comprehension</span>
<a name="l00142"></a>00142 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00143"></a>00143 <span class="preprocessor"></span>
<a name="l00144"></a>00144 <span class="preprocessor">#ifndef MMA7455L_ADDR</span>
<a name="l00145"></a>00145 <span class="preprocessor"></span><span class="preprocessor">#define MMA7455L_ADDR (0x1D&lt;&lt;1)                         // address to communicate with the MMA7455L</span>
<a name="l00146"></a>00146 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00147"></a>00147 <span class="preprocessor"></span>
<a name="l00148"></a>00148 <span class="preprocessor">#ifndef ADXL345_ADDR</span>
<a name="l00149"></a>00149 <span class="preprocessor"></span><span class="preprocessor">#define ADXL345_ADDR (0x53&lt;&lt;1)                          // address to communicate with the ADXL345</span>
<a name="l00150"></a>00150 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00151"></a>00151 <span class="preprocessor"></span>
<a name="l00152"></a>00152 <span class="preprocessor">#ifndef USE_MMAX7455L</span>
<a name="l00153"></a>00153 <span class="preprocessor"></span><span class="preprocessor">#define USE_MMAX7455L 0                                         // for easier code comprehension</span>
<a name="l00154"></a>00154 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00155"></a>00155 <span class="preprocessor"></span>
<a name="l00156"></a>00156 <span class="preprocessor">#ifndef USE_ADXL345</span>
<a name="l00157"></a>00157 <span class="preprocessor"></span><span class="preprocessor">#define USE_ADXL345 1                                           // for easier code comprehension</span>
<a name="l00158"></a>00158 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00159"></a>00159 <span class="preprocessor"></span>
<a name="l00160"></a>00160 <span class="preprocessor">#ifndef USE_NO_ACCEL</span>
<a name="l00161"></a>00161 <span class="preprocessor"></span><span class="preprocessor">#define USE_NO_ACCEL 2                                          // for easier code comprehension</span>
<a name="l00162"></a>00162 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00163"></a>00163 <span class="preprocessor"></span>
<a name="l00164"></a>00164 <span class="comment">/*********************/</span>
<a name="l00165"></a>00165 <span class="comment">/*** HARDWARE DEFS ***/</span>
<a name="l00166"></a>00166 <span class="comment">/*********************/</span>
<a name="l00167"></a>00167 <span class="preprocessor">#ifndef HW_REV</span>
<a name="l00168"></a><a class="code" href="constants_8h.html#a5762cbfb21373b1276207823b543c548">00168</a> <span class="preprocessor"></span><span class="preprocessor">        #define HW_REV_3_0 0</span>
<a name="l00169"></a><a class="code" href="constants_8h.html#a8684553fa5a387fb62bf6e957f791bdf">00169</a> <span class="preprocessor"></span><span class="preprocessor">        #define HW_REV_3_0_1 1</span>
<a name="l00170"></a><a class="code" href="constants_8h.html#ac2c07b9b7f4b283fa98c3309ce431df3">00170</a> <span class="preprocessor"></span><span class="preprocessor">        #define HW_REV_3_1 2</span>
<a name="l00171"></a>00171 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00172"></a>00172 <span class="preprocessor"></span>
<a name="l00173"></a>00173 <span class="preprocessor">#ifndef REMOTE</span>
<a name="l00174"></a>00174 <span class="preprocessor"></span><span class="preprocessor">#define REMOTE (PINJ &amp; _BV(PJ6))&gt;&gt;6                     // tv remote pin state</span>
<a name="l00175"></a>00175 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00176"></a>00176 <span class="preprocessor"></span>
<a name="l00177"></a>00177 <span class="preprocessor">#ifndef SEL0</span>
<a name="l00178"></a>00178 <span class="preprocessor"></span><span class="preprocessor">#define SEL0 (PINC &amp; _BV(PC0))&gt;&gt;0                       // selector pins state</span>
<a name="l00179"></a>00179 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00180"></a>00180 <span class="preprocessor"></span>
<a name="l00181"></a>00181 <span class="preprocessor">#ifndef SEL1</span>
<a name="l00182"></a>00182 <span class="preprocessor"></span><span class="preprocessor">#define SEL1 (PINC &amp; _BV(PC1))&gt;&gt;1</span>
<a name="l00183"></a>00183 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00184"></a>00184 <span class="preprocessor"></span>
<a name="l00185"></a>00185 <span class="preprocessor">#ifndef SEL2</span>
<a name="l00186"></a>00186 <span class="preprocessor"></span><span class="preprocessor">#define SEL2 (PINC &amp; _BV(PC2))&gt;&gt;2</span>
<a name="l00187"></a>00187 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00188"></a>00188 <span class="preprocessor"></span>
<a name="l00189"></a>00189 <span class="preprocessor">#ifndef SEL3</span>
<a name="l00190"></a>00190 <span class="preprocessor"></span><span class="preprocessor">#define SEL3 (PINC &amp; _BV(PC3))&gt;&gt;3</span>
<a name="l00191"></a>00191 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00192"></a>00192 <span class="preprocessor"></span>
<a name="l00193"></a>00193 <span class="preprocessor">#ifndef CHARGE_ON</span>
<a name="l00194"></a>00194 <span class="preprocessor"></span><span class="preprocessor">#define CHARGE_ON ((PINJ &amp; _BV(PJ4))&gt;&gt;4)        // charge_on pin state: 0 =&gt; robot not in charge; 1 =&gt; robot in charge</span>
<a name="l00195"></a>00195 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00196"></a>00196 <span class="preprocessor"></span>
<a name="l00197"></a>00197 <span class="preprocessor">#ifndef BUTTON0</span>
<a name="l00198"></a>00198 <span class="preprocessor"></span><span class="preprocessor">#define BUTTON0 ((PINJ &amp; _BV(PJ5))&gt;&gt;5)          // button pin state: 0 =&gt; button pressed; 1 =&gt; button not pressed</span>
<a name="l00199"></a>00199 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00200"></a>00200 <span class="preprocessor"></span>
<a name="l00201"></a>00201 <span class="preprocessor">#ifndef CHARGE_STAT</span>
<a name="l00202"></a>00202 <span class="preprocessor"></span><span class="preprocessor">#define CHARGE_STAT ((PINJ &amp; _BV(PJ7))&gt;&gt;7)      // charge_stat pin state: 0 =&gt; robot not charged completely; 1 =&gt; robot charged completely </span>
<a name="l00203"></a>00203 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00204"></a>00204 <span class="preprocessor"></span>
<a name="l00205"></a>00205 <span class="preprocessor">#ifndef SENS_ENABLE_OFF</span>
<a name="l00206"></a>00206 <span class="preprocessor"></span><span class="preprocessor">#define SENS_ENABLE_OFF (PORTC &amp;= ~(1 &lt;&lt; 6))// used for sampling the battery</span>
<a name="l00207"></a>00207 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00208"></a>00208 <span class="preprocessor"></span>
<a name="l00209"></a>00209 <span class="preprocessor">#ifndef SENS_ENABLE_ON</span>
<a name="l00210"></a>00210 <span class="preprocessor"></span><span class="preprocessor">#define SENS_ENABLE_ON (PORTC |= (1 &lt;&lt; 6))</span>
<a name="l00211"></a>00211 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00212"></a>00212 <span class="preprocessor"></span>
<a name="l00213"></a>00213 <span class="preprocessor">#ifndef LED_IR1_HIGH</span>
<a name="l00214"></a>00214 <span class="preprocessor"></span><span class="preprocessor">#define LED_IR1_HIGH (PORTC |= (1&lt;&lt;4))          // turn off backward IR</span>
<a name="l00215"></a>00215 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00216"></a>00216 <span class="preprocessor"></span>
<a name="l00217"></a>00217 <span class="preprocessor">#ifndef LED_IR1_LOW</span>
<a name="l00218"></a>00218 <span class="preprocessor"></span><span class="preprocessor">#define LED_IR1_LOW (PORTC &amp;= ~(1&lt;&lt;4))          // turn on backward IR</span>
<a name="l00219"></a>00219 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00220"></a>00220 <span class="preprocessor"></span>
<a name="l00221"></a>00221 <span class="preprocessor">#ifndef LED_IR2_HIGH</span>
<a name="l00222"></a>00222 <span class="preprocessor"></span><span class="preprocessor">#define LED_IR2_HIGH (PORTC |= (1&lt;&lt;5))          // turn off both forward IRs</span>
<a name="l00223"></a>00223 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00224"></a>00224 <span class="preprocessor"></span> 
<a name="l00225"></a>00225 <span class="preprocessor">#ifndef LED_IR2_LOW</span>
<a name="l00226"></a>00226 <span class="preprocessor"></span><span class="preprocessor">#define LED_IR2_LOW (PORTC &amp;= ~(1&lt;&lt;5))          // turn on both forward IRs</span>
<a name="l00227"></a>00227 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00228"></a>00228 <span class="preprocessor"></span>
<a name="l00229"></a>00229 <span class="comment">// the LED_X_ON/OFF macros works only if the leds port pins aren&#39;t</span>
<a name="l00230"></a>00230 <span class="comment">// set in pwm mode</span>
<a name="l00231"></a>00231 <span class="preprocessor">#ifndef LED_RED_OFF</span>
<a name="l00232"></a>00232 <span class="preprocessor"></span><span class="preprocessor">#define LED_RED_OFF (PORTB |= (1&lt;&lt;5))</span>
<a name="l00233"></a>00233 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00234"></a>00234 <span class="preprocessor"></span>
<a name="l00235"></a>00235 <span class="preprocessor">#ifndef LED_GREEN_OFF</span>
<a name="l00236"></a>00236 <span class="preprocessor"></span><span class="preprocessor">#define LED_GREEN_OFF (PORTB |= (1&lt;&lt;6))</span>
<a name="l00237"></a>00237 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00238"></a>00238 <span class="preprocessor"></span>
<a name="l00239"></a>00239 <span class="preprocessor">#ifndef LED_BLUE_OFF</span>
<a name="l00240"></a>00240 <span class="preprocessor"></span><span class="preprocessor">#define LED_BLUE_OFF (PORTB |= (1&lt;&lt;7))</span>
<a name="l00241"></a>00241 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00242"></a>00242 <span class="preprocessor"></span>
<a name="l00243"></a>00243 <span class="preprocessor">#ifndef LED_RED_ON</span>
<a name="l00244"></a>00244 <span class="preprocessor"></span><span class="preprocessor">#define LED_RED_ON (PORTB &amp;= ~(1&lt;&lt;5))</span>
<a name="l00245"></a>00245 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00246"></a>00246 <span class="preprocessor"></span>
<a name="l00247"></a>00247 <span class="preprocessor">#ifndef LED_GREEN_ON</span>
<a name="l00248"></a>00248 <span class="preprocessor"></span><span class="preprocessor">#define LED_GREEN_ON (PORTB &amp;= ~(1&lt;&lt;6))</span>
<a name="l00249"></a>00249 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00250"></a>00250 <span class="preprocessor"></span>
<a name="l00251"></a>00251 <span class="preprocessor">#ifndef LED_BLUE_ON</span>
<a name="l00252"></a>00252 <span class="preprocessor"></span><span class="preprocessor">#define LED_BLUE_ON (PORTB &amp;= ~(1&lt;&lt;7))</span>
<a name="l00253"></a>00253 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00254"></a>00254 <span class="preprocessor"></span>
<a name="l00255"></a>00255 <span class="comment">// small green leds handling macros</span>
<a name="l00256"></a>00256 <span class="preprocessor">#ifndef GREEN_LEDS</span>
<a name="l00257"></a><a class="code" href="constants_8h.html#ad9a17cf6e53645fa105e3999dbf8b62f">00257</a> <span class="preprocessor"></span><span class="preprocessor">#define GREEN_LED0_ON (PORTL &amp;= ~(1 &lt;&lt; 0))</span>
<a name="l00258"></a><a class="code" href="constants_8h.html#a2a0053283905490c55577117992b4b8a">00258</a> <span class="preprocessor"></span><span class="preprocessor">#define GREEN_LED1_ON (PORTL &amp;= ~(1 &lt;&lt; 1))</span>
<a name="l00259"></a><a class="code" href="constants_8h.html#a4ce7f1add49f04728efb00b9eae28337">00259</a> <span class="preprocessor"></span><span class="preprocessor">#define GREEN_LED2_ON (PORTL &amp;= ~(1 &lt;&lt; 2))</span>
<a name="l00260"></a><a class="code" href="constants_8h.html#a14f54d624eaad64f02a6a38e38f1b2c1">00260</a> <span class="preprocessor"></span><span class="preprocessor">#define GREEN_LED3_ON (PORTG &amp;= ~(1 &lt;&lt; 3))</span>
<a name="l00261"></a><a class="code" href="constants_8h.html#ac146c95b9833ffeb59d584def9f40f97">00261</a> <span class="preprocessor"></span><span class="preprocessor">#define GREEN_LED4_ON (PORTL &amp;= ~(1 &lt;&lt; 4))</span>
<a name="l00262"></a><a class="code" href="constants_8h.html#aae645c21a1587af2dc263e33f7028585">00262</a> <span class="preprocessor"></span><span class="preprocessor">#define GREEN_LED5_ON (PORTL &amp;= ~(1 &lt;&lt; 5))</span>
<a name="l00263"></a><a class="code" href="constants_8h.html#a64da4da925691ce954ae115e8b0fe32d">00263</a> <span class="preprocessor"></span><span class="preprocessor">#define GREEN_LED6_ON (PORTL &amp;= ~(1 &lt;&lt; 6))</span>
<a name="l00264"></a><a class="code" href="constants_8h.html#a847ad8e8132433b933ffde01175b2a64">00264</a> <span class="preprocessor"></span><span class="preprocessor">#define GREEN_LED7_ON (PORTL &amp;= ~(1 &lt;&lt; 7))</span>
<a name="l00265"></a><a class="code" href="constants_8h.html#aac52d6f2271fd70bfb7287079744443a">00265</a> <span class="preprocessor"></span><span class="preprocessor">#define GREEN_LED0_OFF (PORTL |= (1 &lt;&lt; 0))</span>
<a name="l00266"></a><a class="code" href="constants_8h.html#a4bc02e7f6920322afd4b20e735510f94">00266</a> <span class="preprocessor"></span><span class="preprocessor">#define GREEN_LED1_OFF (PORTL |= (1 &lt;&lt; 1))</span>
<a name="l00267"></a><a class="code" href="constants_8h.html#a34ce1312efde37852f024b3db8b8a5c9">00267</a> <span class="preprocessor"></span><span class="preprocessor">#define GREEN_LED2_OFF (PORTL |= (1 &lt;&lt; 2))</span>
<a name="l00268"></a><a class="code" href="constants_8h.html#ae9c994739d5d16240301ed46c1c01219">00268</a> <span class="preprocessor"></span><span class="preprocessor">#define GREEN_LED3_OFF (PORTG |= (1 &lt;&lt; 3))</span>
<a name="l00269"></a><a class="code" href="constants_8h.html#a1178f0eff9e07de7b313fb63254a253a">00269</a> <span class="preprocessor"></span><span class="preprocessor">#define GREEN_LED4_OFF (PORTL |= (1 &lt;&lt; 4))</span>
<a name="l00270"></a><a class="code" href="constants_8h.html#a797d5bc8256b4395fe022ee2a900d8eb">00270</a> <span class="preprocessor"></span><span class="preprocessor">#define GREEN_LED5_OFF (PORTL |= (1 &lt;&lt; 5))</span>
<a name="l00271"></a><a class="code" href="constants_8h.html#a81e892feee7918ecf6184d0b101fc0e8">00271</a> <span class="preprocessor"></span><span class="preprocessor">#define GREEN_LED6_OFF (PORTL |= (1 &lt;&lt; 6))</span>
<a name="l00272"></a><a class="code" href="constants_8h.html#a823a8e77b1f3f528dd245ec343085ae4">00272</a> <span class="preprocessor"></span><span class="preprocessor">#define GREEN_LED7_OFF (PORTL |= (1 &lt;&lt; 7))</span>
<a name="l00273"></a>00273 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00274"></a>00274 <span class="preprocessor"></span>
<a name="l00275"></a>00275 <span class="comment">/***********/</span>
<a name="l00276"></a>00276 <span class="comment">/*** ADC ***/</span>
<a name="l00277"></a>00277 <span class="comment">/***********/</span>
<a name="l00278"></a>00278 <span class="preprocessor">#ifndef ACTIVE_PHASE</span>
<a name="l00279"></a>00279 <span class="preprocessor"></span><span class="preprocessor">#define ACTIVE_PHASE 0                                          // for easier code comprehension: indicate the active phase of the motors pwm</span>
<a name="l00280"></a>00280 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00281"></a>00281 <span class="preprocessor"></span>
<a name="l00282"></a>00282 <span class="preprocessor">#ifndef PASSIVE_PHASE</span>
<a name="l00283"></a>00283 <span class="preprocessor"></span><span class="preprocessor">#define PASSIVE_PHASE 1                                         // for easier code comprehension: indicate the passive phase of the motors pwm</span>
<a name="l00284"></a>00284 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00285"></a>00285 <span class="preprocessor"></span>
<a name="l00286"></a>00286 <span class="preprocessor">#ifndef NO_PHASE</span>
<a name="l00287"></a>00287 <span class="preprocessor"></span><span class="preprocessor">#define NO_PHASE 2                                                      // currently no more used (when pwm = 0)</span>
<a name="l00288"></a>00288 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00289"></a>00289 <span class="preprocessor"></span>
<a name="l00290"></a>00290 <span class="preprocessor">#ifndef SAVE_TO_PROX</span>
<a name="l00291"></a>00291 <span class="preprocessor"></span><span class="preprocessor">#define SAVE_TO_PROX 0                                          // for easier code comprehension: indicate that the value currently sampled has </span>
<a name="l00292"></a>00292 <span class="preprocessor"></span><span class="preprocessor">#endif                                                                          // to be saved in the proximity array</span>
<a name="l00293"></a>00293 <span class="preprocessor"></span>
<a name="l00294"></a>00294 <span class="preprocessor">#ifndef SAVE_TO_RIGHT_MOTOR_CURRENT</span>
<a name="l00295"></a>00295 <span class="preprocessor"></span><span class="preprocessor">#define SAVE_TO_RIGHT_MOTOR_CURRENT 1           // for easier code comprehension: current sample is current consumption for right motor</span>
<a name="l00296"></a>00296 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00297"></a>00297 <span class="preprocessor"></span>
<a name="l00298"></a>00298 <span class="preprocessor">#ifndef SAVE_TO_RIGHT_MOTOR_VEL</span>
<a name="l00299"></a>00299 <span class="preprocessor"></span><span class="preprocessor">#define SAVE_TO_RIGHT_MOTOR_VEL 2                       // for easier code comprehension: current sample is velocity for right motor</span>
<a name="l00300"></a>00300 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00301"></a>00301 <span class="preprocessor"></span>
<a name="l00302"></a>00302 <span class="preprocessor">#ifndef SAVE_TO_LEFT_MOTOR_CURRENT</span>
<a name="l00303"></a>00303 <span class="preprocessor"></span><span class="preprocessor">#define SAVE_TO_LEFT_MOTOR_CURRENT 3            // for easier code comprehension: current sample is current consumption for left motor</span>
<a name="l00304"></a>00304 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00305"></a>00305 <span class="preprocessor"></span>
<a name="l00306"></a>00306 <span class="preprocessor">#ifndef SAVE_TO_LEFT_MOTOR_VEL</span>
<a name="l00307"></a>00307 <span class="preprocessor"></span><span class="preprocessor">#define SAVE_TO_LEFT_MOTOR_VEL 4                        // for easier code comprehension: current sample is velocity for left motor</span>
<a name="l00308"></a>00308 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00309"></a>00309 <span class="preprocessor"></span>
<a name="l00310"></a>00310 <span class="preprocessor">#ifndef SKIP_SAMPLE</span>
<a name="l00311"></a>00311 <span class="preprocessor"></span><span class="preprocessor">#define SKIP_SAMPLE 5                                           // currently no more needed</span>
<a name="l00312"></a>00312 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00313"></a>00313 <span class="preprocessor"></span>
<a name="l00314"></a>00314 <span class="preprocessor">#ifndef SAVE_TO_PROX_IRCOMM</span>
<a name="l00315"></a>00315 <span class="preprocessor"></span><span class="preprocessor">#define SAVE_TO_PROX_IRCOMM 6</span>
<a name="l00316"></a>00316 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00317"></a>00317 <span class="preprocessor"></span>
<a name="l00318"></a>00318 <span class="comment">/***************/</span>
<a name="l00319"></a>00319 <span class="comment">/*** SENSORS ***/</span>
<a name="l00320"></a>00320 <span class="comment">/***************/</span>
<a name="l00321"></a>00321 <span class="preprocessor">#ifndef PROX0_AMBIENT                                           // array indices for the sensors for easier code comprehension</span>
<a name="l00322"></a>00322 <span class="preprocessor"></span><span class="preprocessor">#define PROX0_AMBIENT 0</span>
<a name="l00323"></a>00323 <span class="preprocessor"></span><span class="preprocessor">#define PROX0_REFLECTED 1</span>
<a name="l00324"></a>00324 <span class="preprocessor"></span><span class="preprocessor">#define PROX1_AMBIENT 2</span>
<a name="l00325"></a>00325 <span class="preprocessor"></span><span class="preprocessor">#define PROX1_REFLECTED 3</span>
<a name="l00326"></a>00326 <span class="preprocessor"></span><span class="preprocessor">#define PROX2_AMBIENT 4</span>
<a name="l00327"></a>00327 <span class="preprocessor"></span><span class="preprocessor">#define PROX2_REFLECTED 5</span>
<a name="l00328"></a>00328 <span class="preprocessor"></span><span class="preprocessor">#define PROX3_AMBIENT 6</span>
<a name="l00329"></a>00329 <span class="preprocessor"></span><span class="preprocessor">#define PROX3_REFLECTED 7</span>
<a name="l00330"></a>00330 <span class="preprocessor"></span><span class="preprocessor">#define PROX4_AMBIENT 8</span>
<a name="l00331"></a>00331 <span class="preprocessor"></span><span class="preprocessor">#define PROX4_REFLECTED 9</span>
<a name="l00332"></a>00332 <span class="preprocessor"></span><span class="preprocessor">#define PROX5_AMBIENT 10</span>
<a name="l00333"></a>00333 <span class="preprocessor"></span><span class="preprocessor">#define PROX5_REFLECTED 11</span>
<a name="l00334"></a>00334 <span class="preprocessor"></span><span class="preprocessor">#define PROX6_AMBIENT 12</span>
<a name="l00335"></a>00335 <span class="preprocessor"></span><span class="preprocessor">#define PROX6_REFLECTED 13</span>
<a name="l00336"></a>00336 <span class="preprocessor"></span><span class="preprocessor">#define PROX7_AMBIENT 14</span>
<a name="l00337"></a>00337 <span class="preprocessor"></span><span class="preprocessor">#define PROX7_REFLECTED 15</span>
<a name="l00338"></a>00338 <span class="preprocessor"></span><span class="preprocessor">#define GROUND0_AMBIENT 16</span>
<a name="l00339"></a>00339 <span class="preprocessor"></span><span class="preprocessor">#define GROUND0_REFLECTED 17</span>
<a name="l00340"></a>00340 <span class="preprocessor"></span><span class="preprocessor">#define GROUND1_AMBIENT 18</span>
<a name="l00341"></a>00341 <span class="preprocessor"></span><span class="preprocessor">#define GROUND1_REFLECTED 19</span>
<a name="l00342"></a>00342 <span class="preprocessor"></span><span class="preprocessor">#define GROUND2_AMBIENT 20</span>
<a name="l00343"></a>00343 <span class="preprocessor"></span><span class="preprocessor">#define GROUND2_REFLECTED 21</span>
<a name="l00344"></a>00344 <span class="preprocessor"></span><span class="preprocessor">#define GROUND3_AMBIENT 22</span>
<a name="l00345"></a>00345 <span class="preprocessor"></span><span class="preprocessor">#define GROUND3_REFLECTED 23</span>
<a name="l00346"></a>00346 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00347"></a>00347 <span class="preprocessor"></span>
<a name="l00348"></a>00348 <span class="comment">/***********************/</span>
<a name="l00349"></a>00349 <span class="comment">/*** CLIFF AVOIDANCE ***/</span>
<a name="l00350"></a>00350 <span class="comment">/***********************/</span>
<a name="l00351"></a>00351 <span class="preprocessor">#ifndef CLIFF_THR</span>
<a name="l00352"></a>00352 <span class="preprocessor"></span><span class="preprocessor">#define CLIFF_THR 420                                           // ground sensors threshold for detecting a cliff independently of the surface</span>
<a name="l00353"></a>00353 <span class="preprocessor"></span><span class="preprocessor">#endif                                                                          // since the ground sensors are calibrated to 512</span>
<a name="l00354"></a>00354 <span class="preprocessor"></span>
<a name="l00355"></a>00355 <span class="comment">/**************************/</span>
<a name="l00356"></a>00356 <span class="comment">/*** OBSTACLE AVOIDANCE ***/</span>
<a name="l00357"></a>00357 <span class="comment">/**************************/</span>
<a name="l00358"></a>00358 <span class="preprocessor">#ifndef PHASE1                                                          // range values used for linearization of the proximity; this values define </span>
<a name="l00359"></a>00359 <span class="preprocessor"></span><span class="preprocessor">#define PHASE1 60                                                       // the passage from one to the next linear function used to approximate and </span>
<a name="l00360"></a>00360 <span class="preprocessor"></span><span class="preprocessor">#endif                                                                          // linearize the proximity values</span>
<a name="l00361"></a>00361 <span class="preprocessor"></span><span class="preprocessor">#ifndef PHASE2</span>
<a name="l00362"></a>00362 <span class="preprocessor"></span><span class="preprocessor">#define PHASE2 120</span>
<a name="l00363"></a>00363 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00364"></a>00364 <span class="preprocessor"></span><span class="preprocessor">#ifndef PHASE3</span>
<a name="l00365"></a>00365 <span class="preprocessor"></span><span class="preprocessor">#define PHASE3 180</span>
<a name="l00366"></a>00366 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00367"></a>00367 <span class="preprocessor"></span><span class="preprocessor">#ifndef NOISE_THR                                                       // define the value under which the proximity is considered to be noise</span>
<a name="l00368"></a>00368 <span class="preprocessor"></span><span class="preprocessor">#define NOISE_THR 5</span>
<a name="l00369"></a>00369 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00370"></a>00370 <span class="preprocessor"></span>
<a name="l00371"></a>00371 <span class="comment">/****************/</span>
<a name="l00372"></a>00372 <span class="comment">/*** ODOMETRY ***/</span>
<a name="l00373"></a>00373 <span class="comment">/****************/</span>
<a name="l00374"></a><a class="code" href="constants_8h.html#a277445a693c18707e4f1915aa034090f">00374</a> <span class="preprocessor">#define WHEEL_DIST 39.5                 // mm</span>
<a name="l00375"></a>00375 <span class="preprocessor"></span><span class="comment">// the encoders values depends on desired speed: enc = enc + meas_speed*k, where k=function(desired_speed)= a*desired_speed + b</span>
<a name="l00376"></a>00376 <span class="comment">// the following values represent the &quot;b&quot; (offset) and &quot;a&quot; (slope) of the function </span>
<a name="l00377"></a><a class="code" href="constants_8h.html#a1ff0c9691f67607a2105326dc550b94c">00377</a> <span class="preprocessor">#define LEFT_ENC_OFFSET 80.8    // these values are obtained from field test</span>
<a name="l00378"></a><a class="code" href="constants_8h.html#a223b72f1013eb93323b51a6ce5850efd">00378</a> <span class="preprocessor"></span><span class="preprocessor">#define RIGHT_ENC_OFFSET 78.6</span>
<a name="l00379"></a><a class="code" href="constants_8h.html#ad63436288d2bceabc0aeb7105ed7e3d5">00379</a> <span class="preprocessor"></span><span class="preprocessor">#define ENC_SLOPE 0.384</span>
<a name="l00380"></a>00380 <span class="preprocessor"></span>
<a name="l00381"></a><a class="code" href="constants_8h.html#ab5f078646a71bc81cd89b45fa086f085">00381</a> <span class="preprocessor">#define LEFT_WHEEL_FW_SC 0                  // forward, speed control enabled</span>
<a name="l00382"></a><a class="code" href="constants_8h.html#a7559bec7ae26ce8ba6ed794fe82762fb">00382</a> <span class="preprocessor"></span><span class="preprocessor">#define RIGHT_WHEEL_FW_SC 1</span>
<a name="l00383"></a><a class="code" href="constants_8h.html#aca150e54ac62293bf4d8aca015a811dd">00383</a> <span class="preprocessor"></span><span class="preprocessor">#define LEFT_WHEEL_BW_SC 2                                      // backward, speed control enabled</span>
<a name="l00384"></a><a class="code" href="constants_8h.html#a4021427097e655b7f89b7f6af7c71aab">00384</a> <span class="preprocessor"></span><span class="preprocessor">#define RIGHT_WHEEL_BW_SC 3</span>
<a name="l00385"></a><a class="code" href="constants_8h.html#a2f44855f016990d77379303a3791eda4">00385</a> <span class="preprocessor"></span><span class="preprocessor">#define DISTANCE_MM 248.18                                      // distance traveled during calibration =&gt; WHEEL_DIST*2*PI</span>
<a name="l00386"></a><a class="code" href="constants_8h.html#a37a81e4209119603798009671dbc42ab">00386</a> <span class="preprocessor"></span><span class="preprocessor">#define INDEX_STEP 5 //14</span>
<a name="l00387"></a><a class="code" href="constants_8h.html#a4b335e1fc2d1b1443f0fc0961c604015">00387</a> <span class="preprocessor"></span><span class="preprocessor">#define BYTE_TO_MM_S 5</span>
<a name="l00388"></a><a class="code" href="constants_8h.html#a56f83b7a445aba5ced3c6a88392d5cbe">00388</a> <span class="preprocessor"></span><span class="preprocessor">#define CALIBRATION_SAMPLES 9</span>
<a name="l00389"></a><a class="code" href="constants_8h.html#aa3a2f08df33a4d8852f9d8184d018c02">00389</a> <span class="preprocessor"></span><span class="preprocessor">#define CALIB_CHECK_ADDRESS 3946</span>
<a name="l00390"></a><a class="code" href="constants_8h.html#a5496c807936fc3fa89c69d581277381e">00390</a> <span class="preprocessor"></span><span class="preprocessor">#define CALIB_DATA_START_ADDR 3948</span>
<a name="l00391"></a><a class="code" href="constants_8h.html#a3279589b6b22148cecba82a4b529266c">00391</a> <span class="preprocessor"></span><span class="preprocessor">#define HYSTERESIS_THR 75</span>
<a name="l00392"></a>00392 <span class="preprocessor"></span>
<a name="l00393"></a>00393 <span class="comment">/***************/</span>
<a name="l00394"></a>00394 <span class="comment">/*** IR COMM ***/</span>
<a name="l00395"></a>00395 <span class="comment">/***************/</span>
<a name="l00396"></a><a class="code" href="constants_8h.html#a18c729be8e068ea41fcf7283fb55d7a0">00396</a> <span class="preprocessor">#define IRCOMM_MODE_SENSORS_SAMPLING 0</span>
<a name="l00397"></a><a class="code" href="constants_8h.html#a7e4ea04565c92f6373064b298db7fbef">00397</a> <span class="preprocessor"></span><span class="preprocessor">#define IRCOMM_MODE_RECEIVE 1</span>
<a name="l00398"></a><a class="code" href="constants_8h.html#a67d398f176992f039f79a83ab8045790">00398</a> <span class="preprocessor"></span><span class="preprocessor">#define IRCOMM_MODE_TRANSMIT 2</span>
<a name="l00399"></a>00399 <span class="preprocessor"></span><span class="comment">//#define IRCOMM_MODE_RECEIVE_ONLY 3</span>
<a name="l00400"></a>00400 <span class="comment">//#define IRCOMM_MODE_TRANSMIT_ONLY 4</span>
<a name="l00401"></a><a class="code" href="constants_8h.html#a27457700dc973c89d266f5d25ac7581d">00401</a> <span class="preprocessor">#define IRCOMM_SAMPLING_WINDOW 20</span>
<a name="l00402"></a>00402 <span class="preprocessor"></span>
<a name="l00403"></a>00403 
<a name="l00404"></a>00404 <span class="comment">// reception</span>
<a name="l00405"></a><a class="code" href="constants_8h.html#a836d79536e4a820110a2a26dc092e430">00405</a> <span class="preprocessor">#define IRCOMM_RX_IDLE_STATE 1</span>
<a name="l00406"></a><a class="code" href="constants_8h.html#af241e0f675c32f172ee2c277c31cd368">00406</a> <span class="preprocessor"></span><span class="preprocessor">#define IRCOMM_RX_MAX_SENSOR_STATE 2 </span>
<a name="l00407"></a><a class="code" href="constants_8h.html#af4636b650efcaf65a178640e444e7ea3">00407</a> <span class="preprocessor"></span><span class="preprocessor">#define IRCOMM_RX_DETECT_START_BIT_STATE 3</span>
<a name="l00408"></a><a class="code" href="constants_8h.html#aca7676ce4a664544b5ad74d1289a089b">00408</a> <span class="preprocessor"></span><span class="preprocessor">#define IRCOMM_RX_SYNC_SIGNAL 4</span>
<a name="l00409"></a><a class="code" href="constants_8h.html#a77198b0f62ada1e48412687237f82f12">00409</a> <span class="preprocessor"></span><span class="preprocessor">#define IRCOMM_RX_WAITING_BIT 5</span>
<a name="l00410"></a><a class="code" href="constants_8h.html#adafd52f67bd97c4902cb1e442dc572ac">00410</a> <span class="preprocessor"></span><span class="preprocessor">#define IRCOMM_RX_READ_BIT 6</span>
<a name="l00411"></a><a class="code" href="constants_8h.html#a0e0cc316e9d465ace99d362c6e52e8f7">00411</a> <span class="preprocessor"></span><span class="preprocessor">#define IRCOMM_RX_CHECK_CRC 7</span>
<a name="l00412"></a><a class="code" href="constants_8h.html#a0e2eaa5132b13a4fb186757b0e7f91a5">00412</a> <span class="preprocessor"></span><span class="preprocessor">#define IRCOMM_RX_DEBUG 8</span>
<a name="l00413"></a><a class="code" href="constants_8h.html#a3e495173de75d07f5e3c5d51aace04fc">00413</a> <span class="preprocessor"></span><span class="preprocessor">#define IRCOMM_RX_STOP 9</span>
<a name="l00414"></a>00414 <span class="preprocessor"></span>
<a name="l00415"></a><a class="code" href="constants_8h.html#a2b59c2281800038ff13fb24631cd51d9">00415</a> <span class="preprocessor">#define IRCOMM_DETECTION_AMPLITUDE_THR 80 //20</span>
<a name="l00416"></a><a class="code" href="constants_8h.html#ab266ec0181515b8a05d1ed9f97ba4e41">00416</a> <span class="preprocessor"></span><span class="preprocessor">#define IRCOMM_START_BIT_MIN_SWITCH_COUNT 2</span>
<a name="l00417"></a>00417 <span class="preprocessor"></span>
<a name="l00418"></a>00418 <span class="comment">// transmission</span>
<a name="l00419"></a><a class="code" href="constants_8h.html#a17dcc43e56522864bd44d5091bfa201d">00419</a> <span class="preprocessor">#define IRCOMM_TX_IDLE_STATE 1                          // wait the user data to be sent</span>
<a name="l00420"></a><a class="code" href="constants_8h.html#a6c413036fb43f85c16d7c1cf906c58a9">00420</a> <span class="preprocessor"></span><span class="preprocessor">#define IRCOMM_TX_COMPUTE_TIMINGS 2 </span>
<a name="l00421"></a><a class="code" href="constants_8h.html#ac9d80bc7f6b0cf9cd5cce3cf2c43d1c8">00421</a> <span class="preprocessor"></span><span class="preprocessor">#define IRCOMM_TX_TRANSMIT_BIT 3</span>
<a name="l00422"></a><a class="code" href="constants_8h.html#ab5b39c7375b7ad07bf027641f34f140c">00422</a> <span class="preprocessor"></span><span class="preprocessor">#define IRCOMM_TX_PREPARE_TRANSMISSION 5</span>
<a name="l00423"></a>00423 <span class="preprocessor"></span>
<a name="l00424"></a><a class="code" href="constants_8h.html#a80684966c53dd3714bec135f2807a588">00424</a> <span class="preprocessor">#define IRCOMM_TX_ADC_IDLE 0</span>
<a name="l00425"></a><a class="code" href="constants_8h.html#a497e712bfe34e362accb51beefeede2f">00425</a> <span class="preprocessor"></span><span class="preprocessor">#define IRCOMM_TX_ADC_TURN_OFF_SENSORS 1</span>
<a name="l00426"></a><a class="code" href="constants_8h.html#a5df6bd2037850c24c74bf76868e85d5e">00426</a> <span class="preprocessor"></span><span class="preprocessor">#define IRCOMM_TX_ADC_WAIT_PREPARATION 2</span>
<a name="l00427"></a><a class="code" href="constants_8h.html#a76af143ddf679a4b36fb7c87208a4653">00427</a> <span class="preprocessor"></span><span class="preprocessor">#define IRCOMM_TX_ADC_TRANSMISSION_SEQ1 3       // we need two state for byte transmission to change the channel sampled</span>
<a name="l00428"></a><a class="code" href="constants_8h.html#a775a06e3d17d225b8b4baaf2956a2b45">00428</a> <span class="preprocessor"></span><span class="preprocessor">#define IRCOMM_TX_ADC_TRANSMISSION_SEQ2 4       // related to motors</span>
<a name="l00429"></a>00429 <span class="preprocessor"></span>
<a name="l00430"></a><a class="code" href="constants_8h.html#a419aff7d981379ba6ae3e6927b5d0fd5">00430</a> <span class="preprocessor">#define IRCOMM_BIT_START1_SWITCH_COUNT 2</span>
<a name="l00431"></a><a class="code" href="constants_8h.html#a26309a9267a795db43a54a46d6e97132">00431</a> <span class="preprocessor"></span><span class="preprocessor">#define IRCOMM_BIT_START2_SWITCH_COUNT 1</span>
<a name="l00432"></a><a class="code" href="constants_8h.html#a1a0cb6da644f3dfa1cd5a0434987c6cd">00432</a> <span class="preprocessor"></span><span class="preprocessor">#define IRCOMM_BIT0_SWITCH_COUNT 8</span>
<a name="l00433"></a><a class="code" href="constants_8h.html#a72ff53310e1dbbed1e94fee3ce63ed68">00433</a> <span class="preprocessor"></span><span class="preprocessor">#define IRCOMM_BIT1_SWITCH_COUNT 4</span>
<a name="l00434"></a><a class="code" href="constants_8h.html#a84a0f4fc3350f08331ffc376f18c063b">00434</a> <span class="preprocessor"></span><span class="preprocessor">#define IRCOMM_BIT_START1_DURATION 120</span>
<a name="l00435"></a><a class="code" href="constants_8h.html#a4ac1224e13dfb9f5513f812be96713e8">00435</a> <span class="preprocessor"></span><span class="preprocessor">#define IRCOMM_BIT_START2_DURATION 240</span>
<a name="l00436"></a><a class="code" href="constants_8h.html#a9fc274f8c803c4c09d453be5f5ab1b1b">00436</a> <span class="preprocessor"></span><span class="preprocessor">#define IRCOMM_BIT0_DURATION 30 // based on adc isr of 104 us</span>
<a name="l00437"></a><a class="code" href="constants_8h.html#a70d39ee6841ca9dd1f70ca7e81afa35f">00437</a> <span class="preprocessor"></span><span class="preprocessor">#define IRCOMM_BIT1_DURATOIN 60 // based on adc isr of 104 us</span>
<a name="l00438"></a>00438 <span class="preprocessor"></span>
<a name="l00439"></a>00439 <span class="comment">// debug</span>
<a name="l00440"></a><a class="code" href="constants_8h.html#a89974e95c008757caa23492dfa777546">00440</a> <span class="preprocessor">#define DEBUG_MAX_SENSOR_STATE 0</span>
<a name="l00441"></a><a class="code" href="constants_8h.html#afd8e490bc545f56354ef0e6a3738fa1a">00441</a> <span class="preprocessor"></span><span class="preprocessor">#define DEBUG_ALL_SENSORS 0</span>
<a name="l00442"></a><a class="code" href="constants_8h.html#a204ef595264ced74c7e87f117558e70d">00442</a> <span class="preprocessor"></span><span class="preprocessor">#define DEBUG_MAX_SENSOR 0</span>
<a name="l00443"></a><a class="code" href="constants_8h.html#aad3bf0b151454e0bf7d3f89f160f5b1a">00443</a> <span class="preprocessor"></span><span class="preprocessor">#define DEBUG_START_BIT_STATE 0</span>
<a name="l00444"></a><a class="code" href="constants_8h.html#a4551168a25bd97ee15c280da74a8aa6a">00444</a> <span class="preprocessor"></span><span class="preprocessor">#define DEBUG_READ_BIT 0</span>
<a name="l00445"></a><a class="code" href="constants_8h.html#a1871a52670ccbf032904a74ef2dd1f0a">00445</a> <span class="preprocessor"></span><span class="preprocessor">#define DEBUG_BYTE_RECEPTION 0</span>
<a name="l00446"></a><a class="code" href="constants_8h.html#a2e4dbbf0bcd24b4fa145eba8f733e534">00446</a> <span class="preprocessor"></span><span class="preprocessor">#define DEBUG_BYTE_SEQUENCE 0</span>
<a name="l00447"></a>00447 <span class="preprocessor"></span>
<a name="l00448"></a>00448 
</pre></div></div><!-- contents -->
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Defines</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><a class="el" href="constants_8h.html">constants.h</a>      </li>

    <li class="footer">Generated on Thu Dec 4 2014 08:30:44 for Elisa3 by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.6.1 </li>
   </ul>
 </div>


</body>
</html>
